package main

import "fmt"

type student struct {
	ID    int
	Age   rune
	Score rune
	Name  string
}

type studentMgr struct {
	students map[int]*student // 多个学生的信息
}

func (sm *studentMgr) ShowList() {
	for _, v := range sm.students {
		fmt.Printf("id:%d  姓名:%s  年龄:%d  分数:%d \n", v.ID, v.Name, v.Age, v.Score)
	}
}

func (sm *studentMgr) Add(s *student) {
	if _, ok := sm.students[s.ID]; ok {
		fmt.Printf("输入的学生ID:%d 已存在，请修改后重试\n", s.ID)
		return
	}

	sm.students[s.ID] = s
}

func (sm *studentMgr) UpdateByID(id int, name string, age, score rune) {
	if _, ok := sm.students[id]; !ok {
		fmt.Printf("输入的学生ID:%d 不存在 \n", id)
		return
	}


}

func (sm *studentMgr) DeleteByID(id int) {
	if _, ok := sm.students[id]; !ok {
		fmt.Printf("输入的学生ID:%d 不存在 \n", id)
		return
	}

	delete(sm.students, id)
	fmt.Println("删除成功")
}
